package com.shiro.receiver.entity.req;

import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;

import java.util.List;

@Data
public class GroupMessageReqData {

    /**
     * 发送者 {"member_openid": "xxx"} // 用户在本群的 member_openid
     */
    private Author author;

    /**
     * 消息内容
     * 示例：/查询
     */
    private String content;

    /**
     * 群聊id
     * 示例：AE4BE9914B8B6DA1E74378907FD80EE9
     */
    @JSONField(name = "group_id")
    private String groupId;

    /**
     * 群聊openId
     * 示例：AE4BE9914B8B6DA1E74378907FD80EE9
     */
    @JSONField(name = "group_openid")
    private String groupOpenId;

    /**
     * 平台方消息 ID，可以用于被动消息发送
     * 示例：ROBOT1.0_aWj34Ax5Utz-nCWibRMJX7S1WNFy.V8KjmG0uKGsKkV22FjmYdMahcCGfIMTP1ga9lRBTnpOfYoPNFS6TVCssA!!
     */
    private String id;

    /**
     * 消息生产时间（RFC3339）
     * 示例：2024-07-12T11:48:02+08:00
     */
    private String timestamp;

    /**
     * 富媒体文件附件，文件类型："图片，语音，视频，文件"
     */
    private List<Attachment> attachments;

    @Data
    public static class Author {

        /**
         * 发送者id
         * 示例：968CBD77A6E2BDDBCAA2D101413FA712
         */
        private String id;

        /**
         * 发送者在群内的openId
         * 示例：968CBD77A6E2BDDBCAA2D101413FA712
         */
        @JSONField(name = "member_openid")
        private String memberOpenId;

        @JSONField(name = "union_openid")
        private String unionOpenId;

    }

    @Data
    private static class Attachment {

        @JSONField(name = "content_type")
        private String contentType;

        private String filename;

        private Integer height;

        private Integer width;

        private Integer size;

        private String url;

    }

}
